package com.by.zhdoctor.web.rest;

import com.by.zhdoctor.mapper.VisualizationMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.inject.Inject;

/**
 * Created by Abe on 2017-06-06.
 */
@Async
@Component
public class VisualizationTask {
    private final Logger log = LoggerFactory.getLogger(VisualizationTask.class);

    private int D_M_STAT_STAUT;

    @Inject
    private VisualizationMapper visualizationMapper;


    @Scheduled(fixedRate = 1000 * 60 * 60 * 24)
/*    cron = "0 0 0 * * *"   定时每天凌晨0点调度*/
    public  void visualizated(){

        D_M_STAT_STAUT= d_m_stat();
        System.out.println("D_M_ZHENGHE_DOCTOR_STAT表查询更新,执行结果"+D_M_STAT_STAUT);
    }
    /**
     * D_M_ZHENGHE_DOCTOR_STAT表查询更新
     */
    public int d_m_stat(){
        visualizationMapper.deleteDoctorStatAll();
        System.out.println("D_M_ZHENGHE_DOCTOR_STAT表查询更新,执行结果");
        return visualizationMapper.findAllD_STAT();
    }



}
